<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<body>
	<ui:composition template="/template/template.xhtml">
		<ui:define name="title">Group Privileges</ui:define>
		<ui:define name="manuBar">
			<h:form>
				<p:menubar autoSubmenuDisplay="true" id="menu"
					style="font-size:small">
					<p:menuitem value="#{msgs.Administration_administrationMenu_Home}" url="/controlling/index.xhtml"
						icon="ui-icon-document" immediate="true"
						onstart="waiteDialog.show();" />
					<p:menuitem value="#{msgs.Administration_administrationMenu_AdministrationIndex}"
						url="/controlling/administration/administrationIndex.xhtml"
						icon="ui-icon-gear" immediate="true" onstart="waiteDialog.show();" />
				</p:menubar>
			</h:form>
		</ui:define>
		<ui:define name="content">
			<p:panel header="Group Privileges" rendered="#{registeredUser.hasPrivilege(1) or registeredUser.hasPrivilege(2)}">
				<h:form id="frm_privileges">
					<h:panelGrid columns="3">
						<h:outputText value="#{msgs.Administration_Group_GroupName}" />
						<p:selectOneMenu value="#{groupPrivilegeBean.group.recid}"
							style="font:small;">
							<f:selectItem itemLabel="" itemValue="" />
							<f:selectItems value="#{groupPrivilegeBean.groupList}"
								var="group" itemLabel="#{group.name}"
								itemValue="#{group.recid}" />
						</p:selectOneMenu>
						<p:commandButton value="#{msgs.Administration_General_View}" icon="ui-icon-search" ajax="true"
							actionListener="#{groupPrivilegeBean.loadGroupPrivileges}"
							style="height: 32px" onstart="waiteDialog.show()"
							oncomplete="waiteDialog.hide()" update="table_privileges"/>
					</h:panelGrid>
					<br />
					<p:dataTable id="table_privileges"
						value="#{groupPrivilegeBean.privilegeMappingList}"
						var="privilegeMap" paginator="true" rows="20">
						<p:column headerText="#{msgs.Administration_Privilage_Id}" style="width:auto">
							<h:outputText value="#{privilegeMap.privilegeId}" />
						</p:column>
						<p:column headerText="#{msgs.Administration_Privilage_Name}" style="width:auto">
							<h:outputText value="#{privilegeMap.privilegeName}" />
						</p:column>
						<p:column headerText="#{msgs.Administration_Access_AccessName}" style="width:auto">
							<p:selectOneMenu value="#{privilegeMap.accessId}"
								style="font:small;" required="true">
								<f:selectItem itemValue="-1" itemLabel="-----Select Access-----" />
								<f:selectItems value="#{groupPrivilegeBean.accessList}"
									var="access" itemLabel="#{access.name}"
									itemValue="#{access.recid}" />
							</p:selectOneMenu>
						</p:column>
					</p:dataTable>
					<p:commandButton value="#{msgs.Administration_General_Save}"
						actionListener="#{groupPrivilegeBean.saveAllGroupPrivileges}" update="msgs"
						onstart="waiteDialog.show()" oncomplete="waiteDialog.hide()" />
				<p:messages id="msgs"/>
				</h:form>
			</p:panel>
		</ui:define>
	</ui:composition>

</body>
</html>
